/*
 * @Author: cwd
 * @Date: 2022-06-02 10:39:59
 * @LastEditors: cwd
 * @LastEditTime: 2022-06-02 15:27:52
 * @FilePath: \koa2typecsript\src\router\routers.ts
 * @Description: 
 * 
 * Copyright (c) 2022 by cwd, All Rights Reserved. 
 */
import Router from "@koa/router";

import AuthController from '../controllers/auth';
import UserController from '../controllers/user';
import genValidateParams from "../middlewares/validateParams";
import { userRegistervalidation } from "../validator/user";
// auth
const unprotectedRouter  = new Router();
unprotectedRouter.post('/auth/login', AuthController.login);
unprotectedRouter.post('/auth/register',genValidateParams('post',userRegistervalidation), AuthController.register);


//user
const protectedRouter   = new Router();
protectedRouter.get('/users/userdetail', UserController.UserDetail);

export { protectedRouter, unprotectedRouter }; //导出